<%@page import="java.util.List"%>
<%@page import="com.oea.hibernate.entities.Student"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en">

    <jsp:include page="head.jsp"></jsp:include>

        <body style="">
            <!-- topbar starts -->
        <jsp:include page="header.jsp"></jsp:include>
            <!-- topbar ends -->
            <div class="ch-container">
                <div class="row">

                    <!-- left menu starts -->
                <jsp:include page="menu.jsp"></jsp:include>
                    <!-- left menu ends -->





                    <!--jaimin start-->
                <jsp:include page="timetable-parameters-body.jsp"></jsp:include>

                    <!--jaimin end-->


  <jsp:include page="footer.jsp"></jsp:include>
                    <!--/span-->

    <script>
       // window.onload = function() {
            $("#semester_select").change(function() {
                //alert("Val = "+$("#semester_select").val()); 
                    type: "POST",
                    url: "FilterAjaxAction.do",
                    data: "action=getDivisions&branch_id= "+$("#branch_select").val()+"&semester="+$("#semester_select").val(),
                    success: function(data) {
                        console.log(data);
                        data=JSON.parse(data);
                        var html="";
                        $(data).each(function(index,division){
                            html+="<option value="+division.id+">"+division.name+"</option>";
                        });
                         $("#division_select").append(html);  
                        
                       
                    }
                });
            });

            $(".view_anchor").click(function() {
                //alert('u clicked mes');
                var view_id = $(this).attr('id');
                var id = view_id.substring(5); // view_3
                alert($("#td_mname_" + id).text());
                $("#modal_enrollmentno").text($("#td_enrollmentno_" + id).text());
                $("#modal_fname").text($("#td_fname_" + id).text());
//                  $("#modal_fname").text($("#td_fname_" + id).text());
                $("#modal_mname").text($("#td_mname_" + id).text());
                $("#modal_lname").text($("#td_lname_" + id).text());
                $("#modal_gender").text($("#td_gender_" + id).text());
                $("#modal_email").text($("#td_email_" + id).text());
                $("#modal_contact").text($("#td_contact_" + id).text());
            });
            $(".delete_button").click(function() {

                var delete_id = $(this).attr('id');
                var id = delete_id.substring(7); // delete_3

                alert(id);
                $.ajax({
                    type: "POST",
                    url: "DeleteStudentAction.do",
                    data: "id=" + id,
                    success: function(data) {
                        console.log(data);
                        data = JSON.parse(data);
                        if (data.done === '1') {
                            $("#tr_" + id).remove();
                        }
                        else {
                            alert("Data cannot be deleted due to some reason !");
                        }
                    }
                });
            });

      //  }
    </script>


                    <!--/span-->



                    <!-- content ends -->
                </div><!--/#content.col-md-0-->
            </div><!--/fluid-row-->
